/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "news_resources")
//@NamedQueries({@NamedQuery(name = "NewsResources.findAll", query = "SELECT n FROM NewsResources n"), @NamedQuery(name = "NewsResources.findByRid", query = "SELECT n FROM NewsResources n WHERE n.rid = :rid"), @NamedQuery(name = "NewsResources.findByUseragents", query = "SELECT n FROM NewsResources n WHERE n.useragents = :useragents"), @NamedQuery(name = "NewsResources.findByName", query = "SELECT n FROM NewsResources n WHERE n.name = :name"), @NamedQuery(name = "NewsResources.findByResourcetype", query = "SELECT n FROM NewsResources n WHERE n.resourcetype = :resourcetype"), @NamedQuery(name = "NewsResources.findByUrl", query = "SELECT n FROM NewsResources n WHERE n.url = :url"), @NamedQuery(name = "NewsResources.findBySize", query = "SELECT n FROM NewsResources n WHERE n.size = :size"), @NamedQuery(name = "NewsResources.findByRformat", query = "SELECT n FROM NewsResources n WHERE n.rformat = :rformat"), @NamedQuery(name = "NewsResources.findByDistributorid", query = "SELECT n FROM NewsResources n WHERE n.distributorid = :distributorid"), @NamedQuery(name = "NewsResources.findBySpcode", query = "SELECT n FROM NewsResources n WHERE n.spcode = :spcode"), @NamedQuery(name = "NewsResources.findByIsusebysys", query = "SELECT n FROM NewsResources n WHERE n.isusebysys = :isusebysys")})
public class NewsResources implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "rid")
    private Integer rid;
    @Column(name = "useragents")
    private String useragents;
    @Column(name = "name")
    private String name;
    @Column(name = "resourcetype")
    private Integer resourcetype;
    @Column(name = "url")
    private String url;
    @Column(name = "size")
    private Integer size;
    @Column(name = "rformat")
    private String rformat;
    @Column(name = "distributorid")
    private String distributorid;
    @Column(name = "spcode")
    private String spcode;
    @Column(name = "isusebysys")
    private Integer isusebysys;
    @Column(name = "newformat")
    private String newformat;
    @Column(name = "fullpath")
    private String fullpath;
    @JoinTable(name = "news_contenresource", joinColumns = {@JoinColumn(name = "rid", referencedColumnName = "rid")}, inverseJoinColumns = {@JoinColumn(name = "cid", referencedColumnName = "cid")})
    @ManyToMany
    private Set<NewsContenttitle> newsContenttitleSet;

    public NewsResources() {
    }

    public NewsResources(Integer rid) {
        this.rid = rid;
    }

    public Integer getRid() {
        return rid;
    }

    public void setRid(Integer rid) {
        this.rid = rid;
    }

    public String getUseragents() {
        return useragents;
    }

    public void setUseragents(String useragents) {
        this.useragents = useragents;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getResourcetype() {
        return resourcetype;
    }

    public void setResourcetype(Integer resourcetype) {
        this.resourcetype = resourcetype;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    public String getRformat() {
        return rformat;
    }

    public void setRformat(String rformat) {
        this.rformat = rformat;
    }

    public String getDistributorid() {
        return distributorid;
    }

    public void setDistributorid(String distributorid) {
        this.distributorid = distributorid;
    }

    public String getSpcode() {
        return spcode;
    }

    public void setSpcode(String spcode) {
        this.spcode = spcode;
    }

    public Integer getIsusebysys() {
        return isusebysys;
    }

    public void setIsusebysys(Integer isusebysys) {
        this.isusebysys = isusebysys;
    }

    @JSON(serialize=false)	//延迟加载
    public Set<NewsContenttitle> getNewsContenttitleSet() {
        return newsContenttitleSet;
    }

    public void setNewsContenttitleSet(Set<NewsContenttitle> newsContenttitleSet) {
        this.newsContenttitleSet = newsContenttitleSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rid != null ? rid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewsResources)) {
            return false;
        }
        NewsResources other = (NewsResources) object;
        if ((this.rid == null && other.rid != null) || (this.rid != null && !this.rid.equals(other.rid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.NewsResources[rid=" + rid + "]";
    }

	/**
	 * newformat
	 *
	 * @return  the newformat
	 * @since   CodingExample Ver(编码范例查看) 1.0
	 */
	
	public String getNewformat() {
		return newformat;
	}

	/**
	 * @param newformat the newformat to set
	 */
	public void setNewformat(String newformat) {
		this.newformat = newformat;
	}

	/**
	 * fullpath
	 *
	 * @return  the fullpath
	 * @since   CodingExample Ver(编码范例查看) 1.0
	 */
	
	public String getFullpath() {
		return fullpath;
	}

	/**
	 * @param fullpath the fullpath to set
	 */
	public void setFullpath(String fullpath) {
		this.fullpath = fullpath;
	}


}
